﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BotonJXC.DAO;
using BotonJXC.Entity;

namespace BotonJXC.BLL
{
    public class ReturnOrdersBll : BaseBLL<ReturnOrdersDao, ReturnedBlls, int>
    {
        public ReturnOrdersBll() { }




        /// <summary>
        /// 根据出库单编号查询订单
        /// </summary>
        /// <param name="orderSn"></param>
        /// <returns></returns>
        public ReturnedBlls findReturnedBllsBySn(string ReturnedSn)
        {

            IList<ReturnedBlls> list = base.Dao.findReturnedBllsBySn(ReturnedSn);
            if (list != null && list.Count > 0)
            {
                return list[0];
            }
            else
            {
                return null;
            }
        }
        public bool saveReturnOrders(ReturnedBlls ReturnedBlls)
        {
            try
            {
                this.Dao.saveReturnOrders(ReturnedBlls);
                return true;
            }
            catch (Exception)
            {
                return false;
                throw;


            }

        }
        public bool updateReturnOrders(ReturnedBlls ReturnedBlls)
        {
            try
            {
                this.Dao.updateReturnOrders(ReturnedBlls);
                return true;
            }
            catch (Exception)
            {
                throw;
            }
        }

        public bool delReturnOrders(ReturnedBlls ReturnedBlls)
        {
            try
            {
                this.Dao.delReturnOrders(ReturnedBlls);
                return true;
            }
            catch (Exception)
            {
                throw;
            }
        }
        public PageModel<ReturnedBlls> findAllReturnOrders(string ReturnedSn, int SupplierId, int WarehouseId, int start, int count)
        {
            return this.Dao.FindPage(ReturnedSn, SupplierId, WarehouseId, start, count);
        }

        public PageModel<ReturnedBlls> findPageList(ReturnedBlls returnedBlls, int start, int count)
        {
            return Dao.FindByPage(null, null, start, count);
        }
    }
}
